package com.ibeeking.found.open.b.rest.controller.v1;

import com.ibeeking.found.open.api.common.dto.OrderShareScaleDTO;
import com.ibeeking.found.open.b.rest.service.IMarketingService;
import com.ibeeking.found.open.service.common.dto.ActivityListDTO;
import com.ibeeking.found.open.service.common.dto.ActivityStatisticsDTO;
import com.ibeeking.found.open.service.common.query.ActivityListQuery;
import com.ibeeking.found.open.service.common.query.ActivityStatisticsQuery;
import com.ibeeking.found.open.service.common.query.ShareScaleQuery;
import com.ibeeking.nematos.constants.enums.OperateLogTypeEnum;
import com.ibeeking.nematos.log.annotation.Log;
import com.ibeeking.nematos.utils.base.page.Page;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * @ClassName MarketingController控制器
 * @Description
 * @Author ibeeking
 * @Date 2021-06-02 18:15
 **/
@RestController
@RequestMapping("/v1/api/marketing")
public class MarketingController {

    @Resource
    private IMarketingService marketingServiceImpl;

    @Log(logType = OperateLogTypeEnum.QUERY, describe = "查询活动列表")
    @PostMapping(value = "/list")
    public Page<ActivityListDTO> marketingList(@RequestBody @Validated ActivityListQuery query) {
        return marketingServiceImpl.marketingList(query);
    }

    @Log(logType = OperateLogTypeEnum.QUERY, describe = "查询活动统计")
    @PostMapping(value = "/statistics")
    public ActivityStatisticsDTO statistics(@RequestBody @Validated ActivityStatisticsQuery query) {
        return marketingServiceImpl.statistics(query);
    }

    @Log(logType = OperateLogTypeEnum.QUERY, describe = "活动分摊比例")
    @PostMapping(value = "/sharescale")
    public List<OrderShareScaleDTO> shareScale(@RequestBody @Validated ShareScaleQuery query) {
        return marketingServiceImpl.shareScale(query);
    }
}
